<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function Dog({name, type, age}) {
      this.name = name
      this.type = type
      this.age = age
    }

    Dog.prototype = {
      run() {
        console.log(this.name + "会飞快的奔跑");
      },
      showSelf() {
        console.log(`这是一个${this.type}的，${this.age}岁的，叫${this.name}的小狗`);
      }
    }

    var xiaobai = new Dog({
      name: "小白",
      type: "比熊",
      age: 3
    })

    var xiaohei = new Dog({
      name: "小黑",
      type: "拉布拉多",
      age: 3
    })
    // xiaobai.showSelf()
    // xiaobai.run()
    console.log(xiaobai.__proto__);
    console.log(Dog.prototype);
    console.log(xiaohei.__proto__ === xiaobai .__proto__);
  </script>
</body>
</html>